<%@ page language="java" import="java.util.*,com.xiaobin.system.util.*" pageEncoding="UTF-8"%>
<%@ include file="/base/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>${systemOption.systemTitle}</title>
    <%@ include file="/base/head.jsp"%>
    <script type="text/javascript" src="${ctx}/ueditor/third-party/jquery-1.12.0.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${ctx}/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="${ctx}/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="${ctx}/ueditor/lang/zh-cn/zh-cn.js"></script>  
    <script type="text/javascript" charset="UTF-8">
function send(){
	var subject = $('#subject').val();
	if(subject!=""){
		$.messager.progress({msg:'发送中，请稍候...', text:''});
		$('#sendForm').form('submit', {
			onSubmit: function(){
				var isValid = $(this).form('validate');
				if (!isValid){
					$.messager.progress('close');// 当form不合法的时候隐藏工具条
				}
					return isValid;	// 返回false将停止form提交 
			},
			success : function(data) {
				if (data) {
					$.messager.alert('友情提示', '发送成功', 'info');
				} else {
					$.messager.alert('友情提示', '发送失败', 'error');
				}
				$.messager.progress('close'); 
				document.getElementById("sendForm").reset();
				ue.setContent(''); 
			}
		});
	}else{
		$.messager.alert('友情提示', '请填写通知主题', 'error');
	}
}
	</script>
	<style type="text/css">
		.send tr td{padding-bottom:5px; padding-top:5px; height:auto;}
		.send tr td a:link,a:visited{text-decoration:underline;color:#005590;}
		.send tr td  a:hover {text-decoration:none; }
		.label{ text-align:center;width: 100px;font-size: xx-large;font-family: sans-serif;}
	</style>
  </head>
  
  <body style="margin:20px;">
      <!-- 主窗口 --> 
      <h1 style="font-size: xx-large; text-align: center;color: red;">发布通知</h1> 	 
  	  <form name="sendForm" id="sendForm" method="post" action="${ctx }/publish/notice.action">
			<table class="send" cellpadding="0" cellspacing="0" width="100%">
				<tr>
					<td colspan="2" class="toolDiv">
						<a href="javascript:void(0)" onclick="send();" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" style="float:left;">发送</a><div class="datagrid-btn-separator"> </div>
					</td>
				</tr>
				<tr>
					<td align="center" class="label" >
						主题
					</td>
					<td>
						<input id="subject" class="easyui-validatebox" name="subject" type="text" missingMessage="请填写通知主题" style="width:100%;height: 40px;font-size: x-large;">
					</td>
				</tr>
				<tr>
					<td align="center" class="label" >
						内容
					</td>
					<td>
						<div>
   	  	<script id="editor" name="content" type="text/plain" style="height:500px;width:100%;word-break:break-all;">${content}</script>					
        <script type="text/javascript">

    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor');
   
   </script>
						</div>
					</td>
				</tr>
			</table>
		</form>
  </body>
</html>
